package com.gxa.ssm251.factory;

import com.gxa.ssm251.pojo.User;

import java.sql.Date;

public class UserFactory {

    //获得User的实例
    public User newInstance(){
        User user=new User();
        user.setName("toni");
        return user;
    }
    //静态工厂
    public static User newInstance2(){
        User user=new User();
        user.setName("你好明天");
        return user;
    }
    public static Date newDate(){
        User user=new User();
        Date date = new Date(System.currentTimeMillis());
        user.setRegTime(date);
        return date;
    }
}
